package service;

import dao.FlightDao;
import pojo.Flight;

import java.util.List;

public class FlightService {
    private FlightDao flightDao = new FlightDao();

    public List<Flight> selectAllFlights(){
        return flightDao.getAllFlights();
    }

    public List<Flight> selectByDestination(String destination){
        return flightDao.selectByDestination(destination);
    }

    public List<Flight> selectByFlyTime(String flyTime){
        return flightDao.selectByFlyTime(flyTime);
    }

    public Flight selectById(int id){
        return flightDao.selectById(id);
    }

    public void addFlight(Flight flight){
        flightDao.addFlight(flight);
    }

    public void updateFlight(Flight flight){
        flightDao.updateFlight(flight);
    }

    public void deleteById(int id){
        flightDao.deleteFlightById(id);
    }
}
